import {Page} from '@/base/Page';
import {Agent} from '@/base/model/Agent';
import {getAgentList} from '@/base/api/AgentApi';
import {deepAssign} from '@/base/util/Objects';

export class AgentSelectorBloc {

  angent: Page<Agent> = new Page<Agent>([], 0, 1, 15, 0, []);
  loading = false;
  agentList: any = [];

  getAllAngent(pageIndex: number, pageSize: number, sortDirection: string) {
    this.loading = true;
    let that = this;
    return getAgentList({
      pageIndex,
      pageSize
    }).then((res) => {
      this.angent = res.data;
      return this.agentList;
    }).finally(() => {
      this.loading = false;
    });
  }
}
